package com.eastfair.common.api;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.eastfair.boot.request.PageParams;
import com.eastfair.core.base.R;
import com.eastfair.core.base.entity.SuperEntity;
import com.eastfair.pay.dto.ServiceContractPageQuery;
import com.eastfair.pay.dto.ServiceContractSaveDTO;
import com.eastfair.pay.dto.ServiceContractUpdateDTO;
import com.eastfair.pay.vo.ServiceContractVO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@FeignClient(value = "mice-pay/serviceContract")
public interface ServiceContractFeign {

    /**
     * @Author clm
     * @Description //保存
     * @Date 16:31 2022/7/22
     * @Param [saveDTO]
     * @return com.eastfair.core.base.R<com.eastfair.pay.dto.ServiceContractSaveDTO>
     **/
    @PostMapping
    R<ServiceContractSaveDTO> save(@RequestBody @Validated ServiceContractSaveDTO saveDTO);

    /**
     * @Author clm
     * @Description //更新
     * @Date 16:39 2022/7/22
     * @Param [updateDTO]
     * @return com.eastfair.core.base.R<com.eastfair.pay.dto.ServiceContractUpdateDTO>
     **/
    @PutMapping
    R<ServiceContractUpdateDTO> update(@RequestBody @Validated({SuperEntity.Update.class}) ServiceContractUpdateDTO updateDTO);

    /**
     * @Author clm
     * @Description //逻辑删除
     * @Date 16:40 2022/7/22
     * @Param [ids]
     * @return com.eastfair.core.base.R<java.lang.Boolean>
     **/
    @DeleteMapping({"/removeByIdsOfLogic"})
    R<Boolean> deleteOfStatus(@RequestBody List<Long> ids);

    /**
     * @Author clm
     * @Description //分页查询
     * @Date 16:43 2022/7/22
     * @Param [params]
     * @return com.eastfair.core.base.R<com.baomidou.mybatisplus.core.metadata.IPage<com.eastfair.pay.entity.ServiceContractVO>>
     **/
    @PostMapping("/queryPage")
    R<Page<ServiceContractVO>> queryPage(@RequestBody @Validated PageParams<ServiceContractPageQuery> params);

    /**
     * 通过合同id获取详情
     * @param id
     * @return
     */
    @GetMapping("/getContractById/{id}")
    R<ServiceContractVO> getContractById(@PathVariable("id") Long id);


}
